<head>
<style>
div::selection {
  color: red;
  background-color: blue;
}
div {
  width: 1px;
  overflow: visible;
}
</style>
</head>
<div>M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;M&shy;</div>
<script>
document.execCommand('SelectAll')
</script>
